var n=0;
var panel1=new Ext.TabPanel({
	showPage:function(){
	// var page=Ext.getCmp('functionpoint-panel');
	// page.showPage();
	n=1;
},
showxml:function(){
	n=0;
	// showXmlContent(text, "function");
},
	title:"功能展示",
    id : 'showFunctionPanel', 
    miniImg:new Image(),
    iconCls : 'new-topic',     
    region : 'center',     
    resizeTabs : true,     
 // autoDestroy : false,
   tabWidth : 150,     
  // items : [Ext.getCmp('xml-panel'),Ext.getCmp('functionpoint-panel')],
  // layout :"card",
   activeItem : 0,/*
	tbar:[
	      {
	    	  text:"转换视图",
	    	  cls:'x-btn-text-icon',
	    	  // icon:"/images/access/grid/group-by.gif",
	    	  handler:function(){
	    	  alert("OK");
	    	  // n=Ext.getCmp("showFunctionPanel").layout.getActiveItem();
	    	  n=(n+1)%2;
	    	  alert(n);
	    	  Ext.getCmp('showFunctionPanel').layout.setActiveItem(n);
	      },
			}
	      ],*/
	addTab:function(id){
	var page=Ext.getCmp(id);
	if(page!=null){
		this.items.each(function(item){
			if(item.id==id){
				item.doLayout();
				contentPanel.setActiveTab(item);
				return;
			}
		});
		
		this.add(page).show();		
		page.doLayout();
		this.setActiveTab(page);
	}
}
});  
var funXmlPanel =new Ext.Panel({
	id : 'functionxml-panel',
	layout : 'border',
	title:'xml模型文件',
	defaults : {
		collapsible : true,
		bodyStyle : 'padding:15px'
	},
	items : [{
				xtype:'textarea',
				id:'functiontextxml',
				region : 'center',
				autoScroll : true,
				
				border : true
				}]
}) ;
var xmldata;
var xmlName;
var test;
var lineChange="\n";
var change;
var finalformat;
function showFunXmlContent(cid){               //add pathName
	
	Ext.Ajax.request({
	method:'POST',
	url:'showXmlContentAction',
	params : {		
				pathName:cid
			  },
	success : function(request) {
	
	xmldata = request.responseText;
//	Ext.decode(xmldata);
//	xmldata = eval("("+xmldata+")");
//	test=xmldata.xmlContent
//	alert(lineChange);
//	xmldata.replaceAll("xmlContent","a");

	test=xmldata.replace(/lineChange/g,lineChange);
	change=test.replace(/slash/g,"/");
	finalformat=change.replace(/quotation/g,"\"");
	finalformat=finalformat.replace("{"+"\""+"xmlContent"+"\""+":"+"\"","");
	finalformat=finalformat.replace("\""+"}","");

	Ext.getCmp('functiontextxml').setValue(finalformat);

}
	
	});

	// Ext.getCmp('content-panel').layout.setActiveItem('xml-panel');
}

